/**
 * 如何创建组件
 */
import React from 'react'

// 函数组件
const FunctionComponent = () => {
  function clickConsole () {
    console.log('函数组件事件触发')
  }
  return <div onClick={clickConsole}>This is a Function Components!</div>
}

// 类组件
class ClassComponents extends React.Component {
  clickConsole = (e, msg) => {
    console.log(e)
    console.log(msg)
  }
  render () {
    return <div onClick={(e) => this.clickConsole(e, '类组件事件触发')}>This is a Class Components!</div>
  }
}

export {
  FunctionComponent,
  ClassComponents
}